Skip to content

Use .env file for environment variable setup#45

Open
bhousel wants to merge 2 commits intoTaskarCenterAtUW:masterfrom
bhousel:master
Open

Use .env file for environment variable setup#45
bhousel wants to merge 2 commits intoTaskarCenterAtUW:masterfrom
bhousel:master

Conversation

@bhousel
Copy link

@bhousel bhousel commented Mar 13, 2026

Nuxt reads .env files automatically and it's .gitignored, so this makes setup a little easier.

Changes Summary

New Files:

  • .env.example – Added template file for local development environment configuration. Includes example values for Nuxt/Vite environment variables (VITE_* prefixed) for API, OSM, editors, imagery/schema references, and optional Sentry integration, along with guidance comments about environment consistency and local setup.

Updated Files:

README.md – Simplified project setup workflow:

  • Replaced extensive manual environment variable export instructions with a streamlined .env-based approach
  • Setup now reduced to: copy .env.example to .env, install dependencies, and run dev
  • Updated troubleshooting section to reference the .env file
  • Removed previous explicit VITE_* variable exports

nuxt.config.ts – Enabled runtime proxy configuration:

  • Uncommented and activated the nitro.devProxy configuration block
  • Retained existing proxy mappings with additional commented local-backend examples
  • Updated inline comment from hedged note to direct statement

The changes shift environment variable configuration from manual setup to automatic Nuxt file loading, with the .env file kept out of version control via .gitignore.

@coderabbitai
Copy link

coderabbitai bot commented Mar 13, 2026

📝 Walkthrough

Walkthrough

The pull request adds a configuration template file (.env.example) for development environment variables, updates documentation to simplify the setup process with environment file-based configuration, and enables the Nitro development proxy feature in Nuxt configuration.

Changes

Cohort / File(s) Summary
Configuration Setup
.env.example, nuxt.config.ts
Adds environment variable template with Nuxt/Vite configuration for local development (API endpoints, OSM, Sentry); enables nitro.devProxy in Nuxt config.
Documentation
README.md
Replaces explicit VITE_* variable exports with simplified .env-based workflow; updates setup instructions and troubleshooting guidance.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 A .env file hops into view,
With variables for the dev crew,
Config enabled, docs made clear,
Setup simplified, no need to fear! 🌱

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: moving from explicit environment variable exports in documentation to a .env file-based approach, which is reflected in changes to README.md, the addition of .env.example, and the enablement of Nuxt's environment configuration system.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
📝 Coding Plan
  • Generate coding plan for human review comments

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Tip

CodeRabbit can use Trivy to scan for security misconfigurations and secrets in Infrastructure as Code files.

Add a .trivyignore file to your project to customize which findings Trivy reports.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.env.example:
- Around line 18-27: Add the missing VITE_NEW_API_URL entry to the example env
file so the app doesn't start with an undefined base URL: update .env.example to
include a commented example value for VITE_NEW_API_URL (e.g.
VITE_NEW_API_URL=https://api.example.com/) and a short comment matching the
style used for VITE_API_URL/VITE_OSM_URL; this ensures
import.meta.env.VITE_NEW_API_URL used in services/index.ts and the value passed
into WorkspacesClient in services/workspaces.ts is defined for new setups.
- Around line 20-22: The comment is inconsistent: it tells users to edit
nuxt.config.ts devProxy settings but then shows direct localhost URLs
(VITE_API_URL and VITE_OSM_URL). Update the .env.example text to present two
clear, consistent options: (1) proxy mode—explain to set devProxy in
nuxt.config.ts and use proxied base paths (e.g., keep VITE_API_URL and
VITE_OSM_URL pointing at the frontend host or relative paths), and (2)
direct-backend mode—show explicit localhost:PORT values and note to match the
backend port; mention which env variables to change (VITE_API_URL, VITE_OSM_URL)
and reference devProxy in nuxt.config.ts so readers know to choose one mode and
configure ports accordingly.

In `@README.md`:
- Line 23: Update the troubleshooting sentence in README.md to use hyphenated
wording by replacing "double check" with "double-check" so the line reads "If
you run `npm run dev` and nothing happens, double-check your `.env` file." This
targets the exact user-facing troubleshooting sentence in the README.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: eb3a3a05-d567-48ea-812b-e9196e4578a3

📥 Commits

Reviewing files that changed from the base of the PR and between 8234570 and 71e8bc1.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (3)
  • .env.example
  • README.md
  • nuxt.config.ts

Comment on lines +18 to +27
# --- Workspaces Backend ------------------------------------------------------
# The workspaces-backend service, see: https://github.com/TaskarCenterAtUW/workspaces-backend
# If running locally, edit `nuxt.config.ts` devProxy settings and use local port:
# VITE_API_URL=http://localhost:3000/api/v1/
# VITE_OSM_URL=http://localhost:3000/

# Or point at the shared dev instance if you don't need to run it locally.
VITE_API_URL=https://api.workspaces-dev.sidewalks.washington.edu/api/v1/
VITE_OSM_URL=https://osm.workspaces-dev.sidewalks.washington.edu/

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Add missing required env key: VITE_NEW_API_URL.

services/index.ts (Lines 16-23) reads import.meta.env.VITE_NEW_API_URL and services/workspaces.ts (Lines 36-49) passes it into WorkspacesClient. It’s currently missing from .env.example, so new setups can start with an undefined API base URL.

Proposed fix
 # Or point at the shared dev instance if you don't need to run it locally.
 VITE_API_URL=https://api.workspaces-dev.sidewalks.washington.edu/api/v1/
+VITE_NEW_API_URL=https://api.workspaces-dev.sidewalks.washington.edu/api/v1/
 VITE_OSM_URL=https://osm.workspaces-dev.sidewalks.washington.edu/
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.env.example around lines 18 - 27, Add the missing VITE_NEW_API_URL entry to
the example env file so the app doesn't start with an undefined base URL: update
.env.example to include a commented example value for VITE_NEW_API_URL (e.g.
VITE_NEW_API_URL=https://api.example.com/) and a short comment matching the
style used for VITE_API_URL/VITE_OSM_URL; this ensures
import.meta.env.VITE_NEW_API_URL used in services/index.ts and the value passed
into WorkspacesClient in services/workspaces.ts is defined for new setups.

Comment on lines +20 to +22
# If running locally, edit `nuxt.config.ts` devProxy settings and use local port:
# VITE_API_URL=http://localhost:3000/api/v1/
# VITE_OSM_URL=http://localhost:3000/
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Local-backend instructions are inconsistent with the proxy guidance.

Line 20 says to edit nuxt.config.ts proxy settings, but the sample values then point directly to localhost:3000. This is confusing for setup and can route traffic incorrectly depending on local ports.

Proposed clarification
-# If running locally, edit `nuxt.config.ts` devProxy settings and use local port:
-# VITE_API_URL=http://localhost:3000/api/v1/
-# VITE_OSM_URL=http://localhost:3000/
+# If running backend locally, point `nuxt.config.ts` devProxy at your backend
+# (example there uses localhost:8000), and keep frontend URLs proxy-relative:
+# VITE_API_URL=/api/v1/
+# VITE_OSM_URL=/workspaces/
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
# If running locally, edit `nuxt.config.ts` devProxy settings and use local port:
# VITE_API_URL=http://localhost:3000/api/v1/
# VITE_OSM_URL=http://localhost:3000/
# If running backend locally, point `nuxt.config.ts` devProxy at your backend
# (example there uses localhost:8000), and keep frontend URLs proxy-relative:
# VITE_API_URL=/api/v1/
# VITE_OSM_URL=/workspaces/
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.env.example around lines 20 - 22, The comment is inconsistent: it tells
users to edit nuxt.config.ts devProxy settings but then shows direct localhost
URLs (VITE_API_URL and VITE_OSM_URL). Update the .env.example text to present
two clear, consistent options: (1) proxy mode—explain to set devProxy in
nuxt.config.ts and use proxied base paths (e.g., keep VITE_API_URL and
VITE_OSM_URL pointing at the frontend host or relative paths), and (2)
direct-backend mode—show explicit localhost:PORT values and note to match the
backend port; mention which env variables to change (VITE_API_URL, VITE_OSM_URL)
and reference devProxy in nuxt.config.ts so readers know to choose one mode and
configure ports accordingly.

## Troubleshooting

If you run ```npm run dev``` and nothing happens, check that you've set your "exports" as above. Undefined environment variables are not handled gracefully right now. No newline at end of file
If you run `npm run dev` and nothing happens, double check your `.env` file.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Use hyphenated wording in troubleshooting text.

Use “double-check” for correct phrasing in user-facing docs.

Proposed fix
-If you run `npm run dev` and nothing happens, double check your `.env` file.
+If you run `npm run dev` and nothing happens, double-check your `.env` file.
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
If you run `npm run dev` and nothing happens, double check your `.env` file.
If you run `npm run dev` and nothing happens, double-check your `.env` file.
🧰 Tools
🪛 LanguageTool

[grammar] ~23-~23: Use a hyphen to join words.
Context: ...npm run devand nothing happens, double check your.env` file. Undefined enviro...

(QB_NEW_EN_HYPHEN)

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@README.md` at line 23, Update the troubleshooting sentence in README.md to
use hyphenated wording by replacing "double check" with "double-check" so the
line reads "If you run `npm run dev` and nothing happens, double-check your
`.env` file." This targets the exact user-facing troubleshooting sentence in the
README.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant